import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:im_app/im/page/sub/TransferMessagePage.dart';

import '../../pojo/ImPojo.dart';
import '../bloc/TransferMessageCubit.dart';

class TransferMessageSheetView extends StatelessWidget {

  final List<ImMessage> messages;

  const TransferMessageSheetView({ required this.messages, super.key});

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      height: 150,
      child: Column(
        children: [
          ListTile(title: const Text('逐条转发'), onTap: () {
            Navigator.of(context).push(MaterialPageRoute(builder: (context){
              return BlocProvider(create: (BuildContext context) {
                return TransferMessageCubit(messages, TransferType.oneByeOne, TransferScene(sceneType: TransferSceneType.message))
                  ..loadData(messages, TransferType.oneByeOne, TransferScene(sceneType: TransferSceneType.message));
              }, child: const TransferMessagePage(),);
            }));
          },),

          ListTile(title: const Text('合并转发'), onTap: () {
            Navigator.of(context).push(MaterialPageRoute(builder: (context){
              return BlocProvider(create: (BuildContext context) {
                return TransferMessageCubit(messages, TransferType.mergeOne, TransferScene(sceneType: TransferSceneType.message))
                  ..loadData(messages, TransferType.mergeOne, TransferScene(sceneType: TransferSceneType.message));
              }, child: const TransferMessagePage(),);
            }));
          },),

          ListTile(title: const Text('取消'), onTap: () {
            Navigator.of(context).pop();
          },),
        ],
      ),
    );
  }

}